import React from 'react'
import {Menu, Icon} from 'antd'
import {browserHistory} from 'react-router'

const SubMenu = Menu.SubMenu;

class SideMenu extends React.Component {

    onPressMenuItem({item, key, keyPath}) {
        console.log(key);
        switch (key) {
            case '100':
                browserHistory.push('/admin/dashboard');
                break;

            case '401':
                browserHistory.push('/admin/apps');
                break;
        }

    }

    render() {
        return (
            <Menu theme="dark" defaultSelectedKeys={['100']} mode="inline"
                  onClick={this.onPressMenuItem.bind(this)}>
                <Menu.Item key="100">
                    <Icon type="pie-chart"/>
                    <span>首页</span>
                </Menu.Item>
                {/*
                <SubMenu
                    key="200"
                    title={<span><Icon type="user"/><span>用户管理</span></span>}
                >
                    <Menu.Item key="201">普通用户</Menu.Item>
                    <Menu.Item key="202">VIP用户</Menu.Item>
                    <Menu.Item key="203">管理员</Menu.Item>
                </SubMenu>
                <SubMenu
                    key="300"
                    title={<span><Icon type="team"/><span>团队管理</span></span>}
                >
                    <Menu.Item key="301">Team 1</Menu.Item>
                    <Menu.Item key="302">Team 2</Menu.Item>
                </SubMenu>
                <Menu.Item key="400">
                    <Icon type="file"/>
                    <span>File</span>
                </Menu.Item>
                 */}

                <SubMenu key="400"
                         title={<span><Icon type="mobile"/><span>应用管理</span></span>}>
                    <Menu.Item key="401">应用管理</Menu.Item>
                    <Menu.Item key="402">发布应用</Menu.Item>
                </SubMenu>
            </Menu>
        )
    }
}

export default SideMenu;